package com.wyz.saas.common.notifice.task

import android.content.Context
import android.content.Intent

class StopLocationTask : Runnable {

    private val ctx: Context
    private var canExecute = false
    private lateinit var pusher: Intent

    constructor(ctx: Context) {
        this.ctx = ctx
    }

    fun updateTask(pusher: Intent) {
        this.pusher = pusher
        canExecute = true
    }
    fun canExecute(): Boolean {
        return canExecute
    }

    override fun run() {
        if (!canExecute) return
        canExecute = false
        ctx.stopService(pusher)
    }
}